home *** CD-ROM | disk | FTP | other *** search
/ SuperHack / SuperHack CD.bin / Hack / SATTELIT / ECSOURCE.ZIP / MYPIC.ASM < prev    next >
Assembly Source File  |  1995-12-22  |  34KB  |  1,030 lines

  1. ;---------------------------------------------------------------------------
  2. ;PIC16C84 Eurocrypt Decoding Software
  3. ;Reassembled and described by U.K. 12/95
  4. ;
  5. ;Hello hacks !
  6. ;After spending two days time in reassembling this software for 
  7. ;eurocrypt decoding with a piccard i offer you the result.
  8. ;To get a bit more readable code i added a couple of macros
  9. ;which are attached hereto in the file "pic16c84.h".
  10. ;Look, learn, enjoy and improve if you can !
  11. ;---------------------------------------------------------------------------
  12.  
  13.             list    p=16c84
  14.             list    f=inhx8m
  15.             include "pic16c84.h" 
  16.             
  17. ;---------------------------------------------------------------------------
  18. ;Configuration
  19. ;---------------------------------------------------------------------------
  20.  
  21. IoPin       equ     7           ;rb0=0..rb7=7
  22.  
  23. ;---------------------------------------------------------------------------
  24. ;Variables (don`t change, because DES-key routines have not been adapted)
  25. ;---------------------------------------------------------------------------
  26.  
  27. ErrFlag     equ     irp         ;IRP-Bit of statusregister used as errorflag
  28. ChanGroup   equ     tmr0        ;Timer0-Register used as ChannelId-Buffer
  29. RcvBuf      equ     $1c         ;5 Bytes receive buffer
  30. Class       equ     RcvBuf      ;not used
  31. Cmd         equ     RcvBuf+1    ;Instruction what to do...
  32. SubCmd      equ     RcvBuf+2    ;Sub-Command (in some cases)
  33. ChannelId   equ     RcvBuf+3    ;Channelidentifier
  34. DataLen     equ     RcvBuf+4    ;Length of data
  35. TempKey     equ     $21         ;7 bytes storage for current key
  36. Result      equ     $c          ;result of descrambled data
  37. Calc        equ     $14         ;intermediate memory for calculation     
  38.  
  39. ;---------------------------------------------------------------------------
  40. ; Program area
  41. ;---------------------------------------------------------------------------
  42.  
  43.             org     $0
  44.  
  45. Reset       call    FixDelay
  46.             movlwf  $9,DataLen          ;9 Bytes to send
  47.             movlw   TbAtr-TbStart       ;pointer to ATR-Sequence
  48.             call    SendString          ;send ATR
  49.  
  50. MsgLoop     movlw   $90                 ;Send EOL $9000 or Error $9008 
  51.             call    SendByte
  52.             swapf   status,w            ;if Errorflag is set then
  53.             andlw   $8                  ;send $08 (Err) else $00 (EOL)
  54. MsgLopNoEol call    SendByte
  55.             bcf     status,ErrFlag      ;Clear Error-Flag (IRP)
  56.             movlwf  $5,$2c              ;receive 5 Bytes into
  57.             movlwf  RcvBuf,fsr          ;receive buffer
  58. RcvNextByte call    ReadByte
  59.             movwf   indf
  60.             incf    fsr
  61.             decfg   $2c,RcvNextByte
  62.  
  63.             movlwf  TbCmdEnd-TbCmd,$2f  ;Number of valid instructions (11)
  64. NextCmd     movf    $2f,w
  65.             addlw   TbCmd-TbStart-1     ;add table-offset         
  66.             call    Table       
  67.             xorwf   Cmd,w               ;if w=cmd then    
  68.             btfgs   status,z,FoundCmd   ;..goto FoundCmd
  69.             decfg   $2f,NextCmd         ;else if Count>0 then NextCmd
  70.             goto    MsgLoop             ;Unknown Command -> send EOL
  71.  
  72. FoundCmd    movf    $2f,w               ;Command-number in table
  73.             sublw   $9                  ;w:=9-w;
  74.             btfgc   status,c,OnCmdGoto  ;if command-number>9 then OnCmdGoto
  75.             movf    DataLen                   
  76.             btfgs   status,z,OnCmdGoto  ;if DataLen<>0 then
  77.             movf    Cmd,w               ;..reply
  78.             call    SendByte            ;..Instruction
  79.  
  80. OnCmdGoto   movf    $2f,w               ;On Cmd Goto ...
  81.             addlw   TbCmdPro-TbStart-1  ;(was $27)
  82.  
  83. Table       clrf    pclath              ;Clear programcounter highbyte
  84.             addwf   pcl                 ;add offset in w to pc
  85. TbStart
  86. TbAtr       retlw   $3f                 ;Answer to reset sequence
  87.             retlw   $67               
  88.             retlw   $2f                
  89.             retlw   $0
  90.             retlw   $11
  91.             retlw   $14
  92.             retlw   $0
  93.             retlw   $3
  94.             retlw   $68               
  95.  
  96. TbReply04   retlw   $0                  ;Answer of command 04
  97.             retlw   $15
  98.             retlw   $0
  99.             retlw   $d
  100.             retlw   $0
  101.             retlw   $0
  102.             retlw   $0
  103. TbReply04End
  104.  
  105. TbReply06   retlw   $10                 ;Answer of command 06
  106.             retlw   $2
  107.             retlw   $ca
  108.             retlw   $20                
  109.             retlw   $11
  110.             retlw   $7
  111.             retlw   $54                 
  112.             retlw   $56                 
  113.             retlw   $33                 
  114.             retlw   $20                 
  115.             retlw   $20                 
  116.             retlw   $20                 
  117.             retlw   $20                 
  118. TbReply06End
  119.  
  120. TbCmd       retlw   $2              ;Receive DataLen Bytes, Send Error or EOL
  121.             retlw   $f0             ;?
  122.             retlw   $4              ;Send in return + EOL
  123.             retlw   $b8             ;Just return as DataLen tells +$9008 (Error)
  124.             retlw   $ac             ;?
  125.             retlw   $a4             ;Receive DataLen Bytes (Channel identify) + EOL
  126.             retlw   $c0             ;Send 16 Byte descrambled data + EOL
  127.             retlw   $6              ;Send EOL only + EOL
  128.             retlw   $24             ;Just return as DataLen tells + EOL
  129.             retlw   $88             ;Contains data to be descrambled + EOL
  130.             retlw   $26             ;Send $6e00 instead of EOL
  131. TbCmdEnd
  132.  
  133. TbCmdPro    goto    Cmd02orF0           ;$02:
  134.             goto    Cmd02orF0           ;$F0:
  135.             goto    Cmd04               ;$04:
  136.             goto    CmdB8               ;$b8:
  137.             goto    CmdAC               ;$ac:
  138.             goto    GetChanId           ;$a4:
  139.             goto    ReturnData          ;$c0:
  140.             goto    Cmd06               ;$06:
  141.             goto    Cmd24               ;$24:
  142.             goto    Cmd88               ;$88:
  143.             goto    Cmd26               ;$26:
  144. TbCmdProEnd            
  145.  
  146. TbEeKey     retlw   FilmNet-$2100       ;FilmNet+,FilmNet MC
  147.             retlw   TV3-$2100           ;TV3 Norge, TV3 Sweden, TV3 Danmark
  148.             retlw   BBCPrime-$2100      ;BBC Prime
  149.             retlw   TV1000-$2100        ;TV1000,TV1000C
  150.             ;add other key offsets right here, but subtract $2100
  151. TbEeKeyEnd
  152.             
  153. ReadEeprom  bsf     status,rp0          ;Bank 1
  154.             bsf     eecon1,0
  155.             bcf     status,rp0          ;Bank 0
  156.             movf    eedata,w            ;w=eedata
  157.             return 
  158.  
  159. Cmd88       movlw   $1a                 ;Descramble right now !
  160.             subwf   DataLen             ;DataLen:=DataLen-$1a;
  161.             btfgs   ChanGroup,3,OtherKeyOff ;if ChanGroup>7 goto OtherKeyOff
  162.             movf    ChanGroup,w        ;else
  163.             andlw   $7                  
  164.             addlw   TbEeKey-TbStart     ;read KeyOffset
  165.             call    Table               ;...from table
  166.             goto    SetEeAdr            
  167. OtherKeyOff movlw   Unknown1-$2100      ;set offset to fifth key
  168.             btfsc   ChannelId,0
  169.             movlw   Unknown2-$2100      ;or to sixth key
  170.             btfsc   ChanGroup,4
  171.             addlw   $e                  ;and add probably 2 keys (14 bytes)
  172.             
  173.             ;add other channels here (need to know ChanGroup and Id)
  174.             
  175. SetEeAdr    movwf   eeadr               ;set eprom-adress to Key-Offset in w !
  176.             movlwf  TempKey,fsr
  177.             movlwf  $7,$2d              ;read 7 bytes key to TempKey-regist.
  178. NextKeyByt  call    ReadEeprom
  179.             movwf   indf
  180.             incf    eeadr
  181.             incf    fsr
  182.             decfg   $2d,NextKeyByt
  183. Discard1    call    SendRetriev
  184.             call    ReadByte
  185.             decfg   DataLen,Discard1
  186.             call    Get8DcBytes         ;get 8 bytes from decoder
  187.             call    DesKey              ;calculate key
  188.             movfwf  Calc,Result         ;store result
  189.             movfwf  Calc+1,Result+1
  190.             movfwf  Calc+2,Result+2
  191.             movfwf  Calc+3,Result+3
  192.             movfwf  Calc+4,Result+4
  193.             movfwf  Calc+5,Result+5
  194.             movfwf  Calc+6,Result+6
  195.             movfwf  Calc+7,Result+7
  196.             call    Get8DcBytes         ;get 8 bytes from decoder
  197.             call    DesKey              ;calculate
  198.             movlwf  $2,$2c   
  199. discard2    call    SendRetriev         ;discard 2 bytes
  200.             call    ReadByte
  201.             decfg   $2c,discard2
  202.             movlw   $89                 ;Send $89 
  203.             call    SendByte
  204.             movlwf  $8,$2c              ;and get another 8 bytes (no retrieve)
  205. discard3    call    ReadByte
  206.             decfg   $2c,discard3
  207.             goto    MsgLoop             ;that`s it !
  208.  
  209. Cmd24       movf    DataLen
  210.             btfgs   status,z,Cmd02orF0
  211.             incf    Cmd,w
  212.             call    SendByte
  213.  
  214. Cmd02orF0   btfsc   SubCmd,1            ;if SubCmd=1 then
  215.             bsf     status,ErrFlag      ;  Error:=true
  216. cmd02a      movf    DataLen,w           ;do
  217.             btfgs   status,z,MsgLoop    ;  if DataLen=0 then goto MsgLoop
  218.             call    ReadByte            ;  w:=ReadByte();
  219.             xorlw   $40                 
  220.             btfsc   status,z            ;  if Byte=$40 then
  221.             bsf     status,ErrFlag      ;    Error:=true;
  222.             decf    DataLen             ;  Dec(DataLen);
  223.             goto    cmd02a              ;loop; 
  224.  
  225. Cmd04       movlwf  TbReply04-TbStart,ChannelId ;send command 04 reply
  226.             movlw   TbReply04End-TbReply04      ;length of answer
  227. cmd04a      clrf    Cmd
  228.             movwf   SubCmd
  229.             subwf   DataLen,w
  230.             btfgc   status,c,SendStrW
  231.             movwf   Cmd
  232.             movfwf  SubCmd,DataLen
  233.             goto    SendStrW
  234.  
  235. Cmd06       movlwf  TbReply06-TbStart,ChannelId ;send command 06 reply ?
  236.             movlw   TbReply06End-TbReply06      ;length of answer
  237.             goto    cmd04a
  238.  
  239. CmdB8       bsf     status,ErrFlag
  240.             movfwf  $2e,SubCmd
  241.             movfwf  DataLen,Cmd
  242.             clrf    DataLen
  243. SendStrW    movf    ChannelId,w         ;W:=Tabbellenoffset
  244.             call    SendString
  245. untilcmd0   movf    Cmd
  246.             btfgs   status,z,MsgLoop
  247.             movf    SubCmd,w
  248.             call    SendByte
  249.             decf    Cmd
  250.             goto    untilcmd0
  251.  
  252. Cmd26       movlw   $6e                 ;Send $6e00 only
  253.             call    SendByte
  254.             movlw   $0
  255.             goto    MsgLopNoEol
  256.  
  257. CmdAC       movlw   $a8                 ;?
  258.             subwf   SubCmd,w
  259.             btfgs   status,c,Cmd02orF0
  260.             movf    DataLen,w
  261.             btfgc   status,z,cmdac1
  262.             movf    Cmd,w
  263.             call    SendByte
  264. cmdac1      movfwf  SubCmd,$2e
  265.             xorlw   $a4
  266.             btfgs   status,z,cmdacend
  267.             btfgc   SubCmd,7,cmdacend
  268.             movlw   $60
  269.             call    SendByte
  270.             btfss   SubCmd,0
  271.             bsf     status,ErrFlag
  272. cmdacend    goto    MsgLoop
  273.     
  274. GetChanId   btfsc   SubCmd,1            ;identify channel (add other Channels here)
  275.             bsf     status,ErrFlag
  276.             btfgc   SubCmd,2,MsgLoop
  277.             call    ReadByte
  278.             call    ReadByte
  279.             clrf    ChanGroup
  280.             xorlw   $28
  281.             btfgs   status,z,gci_next
  282.             incf    ChanGroup
  283.             xorlw   $2c
  284.             btfgs   status,z,gci_next
  285.             bsf     ChanGroup,3
  286.             xorlw   $4
  287.             btfgs   status,z,gci_next
  288.             incf    ChanGroup
  289.             bsf     status,ErrFlag
  290. gci_next    call    ReadByte
  291.             andlw   $f0
  292.             iorwf   ChanGroup
  293.             btfsc   ChanGroup,4
  294.             bsf     ChanGroup,1
  295.             movlw   $1b
  296.             xorwf   ChanGroup,w
  297.             btfsc   status,z
  298.             bsf     status,ErrFlag
  299.             goto    MsgLoop
  300.  
  301. ReturnData  movlw   $ea                 ;Answer with $ea10
  302.             call    SendByte
  303.             decf    DataLen
  304.             movlw   $10
  305.             call    SendByte
  306.             decf    DataLen
  307.             movlwf  Result,fsr          ;send descrambled data
  308. RDNextByte  movf    DataLen             ;Do
  309.             btfgs   status,z,MsgLoop    ;  if DataLen=0 then goto MsgLoop
  310.             movf    indf,w              ;  w:=indf[fsr];
  311.             call    SendByte            ;  SendByte(w);
  312.             incf    fsr                 ;  Inc(fsr);
  313.             decf    DataLen             ;  Dec(DataLen);
  314.             goto    RDNextByte          ;Loop
  315.  
  316. SendRetriev movlw   $77
  317.  
  318. SendByte    movwf   $2a
  319.             comf    $2a
  320.             movlw   $32
  321.             call    VarDelay
  322.             movlw   (1<<IoPin)^$ff      ;IoPin=ausgang, Rest=Eingang 
  323.             tris    portb               ;ins portb-register
  324.             clrf    $2b    
  325.             bcf     portb,IoPin
  326.             movlwf  $8,$28              ;8 Bits senden
  327. SbLoop      call    FixDelay
  328.             movf    $2a,w
  329.             xorwf   $2b
  330.             btfss   $2a,7
  331.             bcf     portb,IoPin          
  332.             btfsc   $2a,7
  333.             bsf     portb,IoPin
  334.             rlf     $2a
  335.             decfg   $28,SbLoop
  336.             call    FixDelay
  337.             comf    $2b
  338.  
  339.             btfsc   $2b,7
  340.             bsf     portb,IoPin
  341.             btfss   $2b,7
  342.             bcf     portb,IoPin
  343.  
  344.             call    FixDelay
  345.             movlw   $ff                 ;Alle I/O-Pins als Eingang
  346.             tris    portb
  347.             movlw   $4f
  348.             call    VarDelay
  349.             retlw   $0
  350.  
  351. ReadByte    btfgs   portb,IoPin,ReadByte ;read a byte
  352.             movlw   $2a
  353.             call    VarDelay
  354.             movlwf  $9,$28              ;read 9 Bits (? -> other soft works with 8 Bits !)
  355. ReadNextBit bcf     status,c         
  356.             btfsc   portb,IoPin
  357.             bsf     status,c
  358.             rlf     $2a         
  359.             call    FixDelay     
  360.             decfg   $28,ReadNextBit
  361.             rrf     $2a
  362.             movlw   $28
  363.             call    VarDelay
  364.             comf    $2a,w
  365.             return 
  366.  
  367. FixDelay    movlw   $1b                 ;carry out fix or...
  368. VarDelay    movwf   $29                 ;...user defined delay
  369. DelayLoop   decfg   $29,DelayLoop
  370.             retlw   $0
  371.  
  372. Get8DcBytes movlwf  $18,fsr             ;receive 8 Bytes from Decoder
  373.             movlwf  $8,$2c              ;and store them in registers $18-$1F
  374. GetNextDc   call    SendRetriev
  375.             call    ReadByte
  376.             movwf   indf
  377.             incf    fsr
  378.             decfg   $2c,GetNextDc
  379.             retlw   $0
  380.  
  381. SendString  movwf   $2d                 ;store w as tableoffset
  382.             movf    DataLen             ;check length of data
  383.             btfsc   status,z            ;return if length is null
  384.             return 
  385. SendNextByt movf    $2d,w               ;reload table offset
  386.             call    Table               ;get byte from table to w
  387.             xorlw   $ff                 
  388.             btfss   status,z            ;if tablebyte<>$ff then
  389.             incf    $2d                 ;  Inc(Offset);
  390.             xorlw   $ff                 ;repair changes
  391.             call    SendByte            
  392.             decfg   DataLen,SendNextByt ;send next byte until lenght=0
  393.             return 
  394.  
  395. DesTable    call    DesTable1          
  396.             movwf   $2e
  397.             return 
  398.  
  399. DesKey      movlwf  $10,$20             ;DES-Key Algorithmus
  400. DkLoop1     call    DesKeyEnd
  401.             movwf   $2f
  402. DkLoop2     rlf     $24,w
  403.             andlw   $e0
  404.             movwf   $2e
  405.             btfsc   $21,7
  406.             bsf     $2e,4
  407.             rlf     $23
  408.             rlf     $22
  409.             rlf     $21
  410.             swapf   $24
  411.             rlf     $24,w
  412.             andlw   $e0
  413.             movwf   $24
  414.             swapf   $24
  415.             btfsc   $25,7
  416.             bsf     $24,0
  417.             rlf     $27
  418.             rlf     $26
  419.             rlf     $25
  420.             movf    $2e,w
  421.             iorwf   $24
  422.             decfg   $2f,DkLoop2
  423.             clrf    $28
  424.             clrf    $29   
  425.             clrf    $2a
  426.             clrf    $2b
  427.             clrf    $2c   
  428.             clrf    $2d
  429.             btfsc   $22,2
  430.             bsf     $28,7
  431.             btfsc   $23,7
  432.             bsf     $28,6
  433.             btfsc   $22,5
  434.             bsf     $28,5
  435.             btfsc   $23,0
  436.             bsf     $28,4
  437.             btfsc   $21,7
  438.             bsf     $28,3
  439.             btfsc   $21,3
  440.             bsf     $28,2
  441.             btfsc   $21,5
  442.             bsf     $28,1
  443.             btfsc   $24,4
  444.             bsf     $28,0
  445.             btfsc   $22,1
  446.             bsf     $29,7
  447.             btfsc   $21,2
  448.             bsf     $29,6
  449.             btfsc   $23,3
  450.             bsf     $29,5
  451.             btfsc   $22,6
  452.             bsf     $29,4
  453.             btfsc   $23,1
  454.             bsf     $29,3
  455.             btfsc   $23,5
  456.             bsf     $29,2
  457.             btfsc   $22,4
  458.             bsf     $29,1
  459.             btfsc   $21,4
  460.             bsf     $29,0
  461.             btfsc   $24,6
  462.             bsf     $2a,7
  463.             btfsc   $21,0
  464.             bsf     $2a,6
  465.             btfsc   $22,0
  466.             bsf     $2a,5
  467.             btfsc   $21,1
  468.             bsf     $2a,4
  469.             btfsc   $24,5
  470.             bsf     $2a,3
  471.             btfsc   $23,4
  472.             bsf     $2a,2
  473.             btfsc   $22,3
  474.             bsf     $2a,1
  475.             btfsc   $21,6
  476.             bsf     $2a,0
  477.             btfsc   $26,7
  478.             bsf     $2b,7
  479.             btfsc   $27,4
  480.             bsf     $2b,6
  481.             btfsc   $24,1
  482.             bsf     $2b,5
  483.             btfsc   $25,3
  484.             bsf     $2b,4
  485.             btfsc   $26,1
  486.             bsf     $2b,3
  487.             btfsc   $27,1
  488.             bsf     $2b,2
  489.             btfsc   $24,2
  490.             bsf     $2b,1
  491.             btfsc   $25,0
  492.             bsf     $2b,0
  493.             btfsc   $27,5
  494.             bsf     $2c,7
  495.             btfsc   $26,3
  496.             bsf     $2c,6
  497.             btfsc   $25,7
  498.             bsf     $2c,5
  499.             btfsc   $26,0
  500.             bsf     $2c,4
  501.             btfsc   $26,4
  502.             bsf     $2c,3
  503.             btfsc   $27,7
  504.             bsf     $2c,2
  505.             btfsc   $25,1
  506.             bsf     $2c,1
  507.             btfsc   $27,0
  508.             bsf     $2c,0
  509.             btfsc   $25,6
  510.             bsf     $2d,7
  511.             btfsc   $27,3
  512.             bsf     $2d,6
  513.             btfsc   $26,2
  514.             bsf     $2d,5
  515.             btfsc   $26,6
  516.             bsf     $2d,4
  517.             btfsc   $27,6
  518.             bsf     $2d,3
  519.             btfsc   $25,4
  520.             bsf     $2d,2
  521.             btfsc   $24,3
  522.             bsf     $2d,1
  523.             btfsc   $24,0
  524.             bsf     $2d,0
  525.             clrf    $14
  526.             clrf    $15
  527.             clrf    $16
  528.             clrf    $17
  529.             clrf    $2e
  530.             rrf     $1c,w
  531.             andlw   $7c
  532.             btfsc   $1f,0
  533.             iorlw   $80
  534.             xorwf   $28,w
  535.             movwf   $2e
  536.             rrf     $2e
  537.             rrf     $2e,w
  538.             andlw   $3f
  539.             call    DesTable
  540.             btfsc   $2e,3
  541.             bsf     $15,7
  542.             btfsc   $2e,2
  543.             bsf     $16,7
  544.             btfsc   $2e,1
  545.             bsf     $16,1
  546.             btfsc   $2e,0
  547.             bsf     $17,1
  548.             clrf    $2e
  549.             rlf     $1c,w
  550.             andlw   $3e
  551.             movwf   $2e
  552.             btfsc   $1d,7
  553.             bsf     $2e,0
  554.             swapf   $29,w
  555.             andlw   $f
  556.             btfsc   $28,0
  557.             iorlw   $10
  558.             btfsc   $28,1
  559.             iorlw   $20
  560.             xorwf   $2e,w
  561.             iorlw   $40
  562.             call    DesTable
  563.             btfsc   $2e,3
  564.             bsf     $15,3
  565.             btfsc   $2e,2
  566.             bsf     $17,4
  567.             btfsc   $2e,1
  568.             bsf     $14,6
  569.             btfsc   $2e,0
  570.             bsf     $16,6
  571.             clrf    $2e
  572.             rrf     $1d,w
  573.             movwf   $2e
  574.             rrf     $2e
  575.             rrf     $2e
  576.             movlw   $1f
  577.             andwf   $2e
  578.             btfsc   $1c,0
  579.             bsf     $2e,5
  580.             rlf     $29,w
  581.             addwf   $29,w
  582.             addwf   $29,w
  583.             andlw   $3c
  584.             btfsc   $2a,6
  585.             iorlw   $1
  586.             btfsc   $2a,7
  587.             iorlw   $2
  588.             xorwf   $2e,w
  589.             iorlw   $80
  590.             call    DesTable
  591.             btfsc   $2e,3
  592.             bsf     $16,0
  593.             btfsc   $2e,2
  594.             bsf     $15,0
  595.             btfsc   $2e,1
  596.             bsf     $17,2
  597.             btfsc   $2e,0
  598.             bsf     $14,2
  599.             clrf    $2e
  600.             rlf     $1d,w
  601.             andlw   $3e
  602.             btfsc   $1e,7
  603.             iorlw   $1
  604.             xorwf   $2a,w
  605.             iorlw   $c0
  606.             call    DesTable
  607.             btfsc   $2e,3
  608.             bsf     $17,6
  609.             btfsc   $2e,2
  610.             bsf     $16,4
  611.             btfsc   $2e,1
  612.             bsf     $15,6
  613.             btfsc   $2e,0
  614.             bsf     $14,7
  615.             clrf    $2e
  616.             rrf     $1e,w
  617.             andlw   $7c
  618.             btfsc   $1d,0
  619.             iorlw   $80
  620.             xorwf   $2b,w
  621.             movwf   $2e
  622.             rrf     $2e
  623.             rrf     $2e,w
  624.             andlw   $3f
  625.             call    DesTable
  626.             btfsc   $2e,7
  627.             bsf     $14,0
  628.             btfsc   $2e,6
  629.             bsf     $15,2
  630.             btfsc   $2e,5
  631.             bsf     $17,7
  632.             btfsc   $2e,4
  633.             bsf     $14,5
  634.             clrf    $2e
  635.             rlf     $1e,w
  636.             andlw   $3e
  637.             movwf   $2e
  638.             btfsc   $1f,7
  639.             bsf     $2e,0
  640.             swapf   $2c,w
  641.             andlw   $f
  642.             btfsc   $2b,0
  643.             iorlw   $10
  644.             btfsc   $2b,1
  645.             iorlw   $20
  646.             xorwf   $2e,w
  647.             iorlw   $40
  648.             call    DesTable
  649.             btfsc   $2e,7
  650.             bsf     $14,4
  651.             btfsc   $2e,6
  652.             bsf     $17,3
  653.             btfsc   $2e,5
  654.             bsf     $15,5
  655.             btfsc   $2e,4
  656.             bsf     $16,5
  657.             clrf    $2e
  658.             rrf     $1f,w
  659.             movwf   $2e
  660.             rrf     $2e
  661.             rrf     $2e
  662.             movlw   $1f
  663.             andwf   $2e
  664.             btfsc   $1e,0
  665.             bsf     $2e,5
  666.             rlf     $2c,w
  667.             addwf   $2c,w
  668.             addwf   $2c,w
  669.             andlw   $3c
  670.             btfsc   $2d,6
  671.             iorlw   $1
  672.             btfsc   $2d,7
  673.             iorlw   $2
  674.             xorwf   $2e,w
  675.             andlw   $3f
  676.             iorlw   $80
  677.             call    DesTable
  678.             btfsc   $2e,7
  679.             bsf     $17,0
  680.             btfsc   $2e,6
  681.             bsf     $15,4
  682.             btfsc   $2e,5
  683.             bsf     $16,2
  684.             btfsc   $2e,4
  685.             bsf     $14,1
  686.             clrf    $2e
  687.             rlf     $1f,w
  688.             andlw   $3e
  689.             btfsc   $1c,7
  690.             iorlw   $1
  691.             xorwf   $2d,w
  692.             iorlw   $c0
  693.             call    DesTable
  694.             btfsc   $2e,7
  695.             bsf     $14,3
  696.             btfsc   $2e,6
  697.             bsf     $17,5
  698.             btfsc   $2e,5
  699.             bsf     $15,1
  700.             btfsc   $2e,4
  701.             bsf     $16,3
  702.             movf    $18,w
  703.             xorwf   $14
  704.             movf    $19,w
  705.             xorwf   $15
  706.             movf    $1a,w
  707.             xorwf   $16
  708.             movf    $1b,w
  709.             xorwf   $17
  710.             movfwf  $1c,$18
  711.             movfwf  $1d,$19
  712.             movfwf  $1e,$1a
  713.             movfwf  $1f,$1b
  714.             movfwf  $14,$1c
  715.             movfwf  $15,$1d
  716.             movfwf  $16,$1e
  717.             movfwf  $17,$1f
  718.             decfg   $20,DkLoop1
  719.             retlw   $0
  720. DesKeyEnd   decf    $20,w
  721.             btfsc   status,z
  722.             retlw   $1
  723.             sublw   $d
  724.             btfss   status,c
  725.             retlw   $1
  726.             xorlw   $6
  727.             btfsc   status,z
  728.             retlw   $1
  729.             retlw   $2
  730. SpaceStart  
  731.             ;here is some space left        
  732. SpaceEnd
  733.             org     $2fd 
  734.  
  735. DesTable1   bsf     pclath,0            ;PC=$300+w; (don`t move it)
  736.             bsf     pclath,1
  737.             movwf   pcl
  738.             retlw   $2e                 ;first table value starts at $300 !
  739.             retlw   $e0
  740.             retlw   $c4
  741.             retlw   $bf
  742.             retlw   $4d                
  743.             retlw   $27                
  744.             retlw   $11
  745.             retlw   $c4
  746.             retlw   $72                
  747.             retlw   $4e                
  748.             retlw   $af
  749.             retlw   $72                
  750.             retlw   $bb
  751.             retlw   $dd
  752.             retlw   $68               
  753.             retlw   $11
  754.             retlw   $83
  755.             retlw   $5a             
  756.             retlw   $5a       
  757.             retlw   $6
  758.             retlw   $36    
  759.             retlw   $fc
  760.             retlw   $fc
  761.             retlw   $ab
  762.             retlw   $d5
  763.             retlw   $39     
  764.             retlw   $9
  765.             retlw   $95
  766.             retlw   $e0
  767.             retlw   $83
  768.             retlw   $97
  769.             retlw   $68    
  770.             retlw   $44    
  771.             retlw   $bf
  772.             retlw   $21       
  773.             retlw   $8c
  774.             retlw   $1e
  775.             retlw   $c8
  776.             retlw   $b8
  777.             retlw   $72    
  778.             retlw   $ad
  779.             retlw   $14
  780.             retlw   $d6
  781.             retlw   $e9
  782.             retlw   $72     
  783.             retlw   $21        
  784.             retlw   $8b
  785.             retlw   $d7
  786.             retlw   $ff
  787.             retlw   $65        
  788.             retlw   $9c
  789.             retlw   $fb
  790.             retlw   $c9
  791.             retlw   $3
  792.             retlw   $57       
  793.             retlw   $9e
  794.             retlw   $63        
  795.             retlw   $aa
  796.             retlw   $3a        
  797.             retlw   $40        
  798.             retlw   $5
  799.             retlw   $56        
  800.             retlw   $e0
  801.             retlw   $3d        
  802.             retlw   $cf
  803.             retlw   $a3
  804.             retlw   $11
  805.             retlw   $fd
  806.             retlw   $a8
  807.             retlw   $44        
  808.             retlw   $fe
  809.             retlw   $27        
  810.             retlw   $96
  811.             retlw   $7f
  812.             retlw   $2b         
  813.             retlw   $c2
  814.             retlw   $63         
  815.             retlw   $98
  816.             retlw   $84
  817.             retlw   $5e            
  818.             retlw   $9
  819.             retlw   $6c         
  820.             retlw   $d7
  821.             retlw   $10
  822.             retlw   $32      
  823.             retlw   $d1
  824.             retlw   $4d        
  825.             retlw   $ea
  826.             retlw   $ec
  827.             retlw   $6
  828.             retlw   $70         
  829.             retlw   $b9
  830.             retlw   $55         
  831.             retlw   $3b           
  832.             retlw   $ba
  833.             retlw   $85
  834.             retlw   $90
  835.             retlw   $4d          
  836.             retlw   $ee
  837.             retlw   $38            
  838.             retlw   $f7
  839.             retlw   $2a            
  840.             retlw   $5b          
  841.             retlw   $c1
  842.             retlw   $2a            
  843.             retlw   $93
  844.             retlw   $84
  845.             retlw   $5f         
  846.             retlw   $cd
  847.             retlw   $f4
  848.             retlw   $31         
  849.             retlw   $a2
  850.             retlw   $75         
  851.             retlw   $bb
  852.             retlw   $8
  853.             retlw   $e6
  854.             retlw   $4c            
  855.             retlw   $17
  856.             retlw   $a6
  857.             retlw   $7c
  858.             retlw   $19
  859.             retlw   $60          
  860.             retlw   $d3
  861.             retlw   $5
  862.             retlw   $b2
  863.             retlw   $8e
  864.             retlw   $6f            
  865.             retlw   $d9
  866.             retlw   $4a            
  867.             retlw   $dd
  868.             retlw   $b0
  869.             retlw   $7
  870.             retlw   $29           
  871.             retlw   $b0
  872.             retlw   $ee
  873.             retlw   $79         
  874.             retlw   $f6
  875.             retlw   $43            
  876.             retlw   $3
  877.             retlw   $94
  878.             retlw   $8f
  879.             retlw   $16
  880.             retlw   $d5
  881.             retlw   $aa
  882.             retlw   $31            
  883.             retlw   $e2
  884.             retlw   $cd
  885.             retlw   $38           
  886.             retlw   $9c
  887.             retlw   $55            
  888.             retlw   $77           
  889.             retlw   $ce
  890.             retlw   $5b            
  891.             retlw   $2c           
  892.             retlw   $a4
  893.             retlw   $fb
  894.             retlw   $62            
  895.             retlw   $8f
  896.             retlw   $18
  897.             retlw   $61            
  898.             retlw   $1d
  899.             retlw   $61            
  900.             retlw   $46             
  901.             retlw   $ba
  902.             retlw   $b4
  903.             retlw   $dd
  904.             retlw   $d9
  905.             retlw   $80
  906.             retlw   $c8
  907.             retlw   $16
  908.             retlw   $3f            
  909.             retlw   $49              
  910.             retlw   $73              
  911.             retlw   $a8
  912.             retlw   $e0
  913.             retlw   $77             
  914.             retlw   $ab
  915.             retlw   $94
  916.             retlw   $f1
  917.             retlw   $5f                
  918.             retlw   $62                
  919.             retlw   $e
  920.             retlw   $8c
  921.             retlw   $f3
  922.             retlw   $5
  923.             retlw   $eb
  924.             retlw   $5a                
  925.             retlw   $25                
  926.             retlw   $9e
  927.             retlw   $32               
  928.             retlw   $27               
  929.             retlw   $cc
  930.             retlw   $d7
  931.             retlw   $1d
  932.             retlw   $2d               
  933.             retlw   $f8
  934.             retlw   $8e
  935.             retlw   $db
  936.             retlw   $43                
  937.             retlw   $85
  938.             retlw   $60               
  939.             retlw   $a6
  940.             retlw   $f6
  941.             retlw   $3f                
  942.             retlw   $b9
  943.             retlw   $70                
  944.             retlw   $1a
  945.             retlw   $43               
  946.             retlw   $a1
  947.             retlw   $c4
  948.             retlw   $92
  949.             retlw   $57               
  950.             retlw   $38               
  951.             retlw   $62             
  952.             retlw   $e5
  953.             retlw   $bc
  954.             retlw   $5b              
  955.             retlw   $1
  956.             retlw   $c
  957.             retlw   $ea
  958.             retlw   $c4
  959.             retlw   $9e
  960.             retlw   $7f
  961.             retlw   $29            
  962.             retlw   $7a  
  963.             retlw   $23     
  964.             retlw   $b6
  965.             retlw   $1f
  966.             retlw   $49  
  967.             retlw   $e0
  968.             retlw   $10
  969.             retlw   $76   
  970.             retlw   $9c
  971.             retlw   $4a 
  972.             retlw   $cb
  973.             retlw   $a1
  974.             retlw   $e7
  975.             retlw   $8d
  976.             retlw   $2d                
  977.             retlw   $d8
  978.             retlw   $f
  979.             retlw   $f9
  980.             retlw   $61                
  981.             retlw   $c4
  982.             retlw   $a3
  983.             retlw   $95
  984.             retlw   $de
  985.             retlw   $b
  986.             retlw   $f5
  987.             retlw   $3c                
  988.             retlw   $32                
  989.             retlw   $57                
  990.             retlw   $58                
  991.             retlw   $62                
  992.             retlw   $84
  993.             retlw   $be
  994.  
  995. ;---------------------------------------------------------------------------
  996. ;Fuses
  997. ;---------------------------------------------------------------------------
  998.  
  999.             org     $2007
  1000.  
  1001.             dw      xt               ;OSC=XT CP=ON WDT=OFF PWR=OFF
  1002.  
  1003. ;---------------------------------------------------------------------------
  1004. ;EEprom-Data -> Keys
  1005. ;---------------------------------------------------------------------------
  1006.  
  1007.             org     $2100
  1008.  
  1009. FilmNet     dw      $f2,$58,$27,$33,$e5,$79,$61
  1010. TV3         dw      $a5,$56,$32,$10,$25,$d7,$c8
  1011. BBCPrime    dw      $99,$01,$00,$5c,$63,$f8,$50
  1012. TV1000      dw      $90,$87,$fd,$b7,$85,$00,$df
  1013. Unknown1    dw      $c7,$01,$4b,$3b,$2f,$dd,$be
  1014. Unknown2    dw      $b6,$3d,$d6,$68,$83,$1f,$5d
  1015. Unknown3    dw      $ad,$b5,$f2,$f6,$3b,$4d,$a2
  1016. Unknown4    dw      $a3,$49,$e3,$d2,$95,$9d,$91
  1017.  
  1018. ;The following codes have been sucked from other hacks and could be
  1019. ;implemented... try it.
  1020.  
  1021. ;Nordic1     dw      $84,$66,$30,$e4,$da,$fa,$23 
  1022. ;Nordic2     dw      $33,$22,$44,$53,$ff,$58,$50 
  1023. ;Nordic3     dw      $73,$13,$c6,$8a,$35,$fd,$e7
  1024. ;Nordic4     dw      $ab,$df,$e3,$94,$09,$52,$da
  1025. ;Unknown5    dw      $48,$63,$c5,$b3,$da,$e3,$29
  1026. ;TV3old      dw      $18,$07,$4e,$fd,$ef,$f4,$50 
  1027. ;Flashcard   dw      $4b,$d3,$07,$96,$49,$f9,$2d
  1028.  
  1029.             end
  1030.